package leecode

func FindFinalValue(nums []int, original int) int {
	numsMap := make(map[int]int, len(nums))
	for _, num := range nums {
		numsMap[num] = num
	}
	for _, _ = range numsMap {
		_, ok := numsMap[original]
		if ok {
			//如果能够找到
			original = original * 2
		} else {
			break
		}
	}
	return original
}
